from datetime import *
import turtle as t
# 画数字
def drawDate(date):
    for i in date:
        if i=='-':
            t.write("年",font=("Arial",18,"normal"))
            t.pencolor("green")
            t.fd(40)
        elif i=="=":
            t.write("月",font=("Arial",18,"normal"))
            t.pencolor("blue")
            t.fd(40)
        elif i=="+":
            t.write("日",font=("Arial",18,"normal"))
        else:
            drawDigit(eval(i))
        # drawDigit(eval(i))

# 画线
def drawDigit(d):
    if d in [2,3,4,5,6,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    if d in [0,1,3,4,5,6,7,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    if d in [0,2,3,5,6,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    if d in [0,2,6,8]:
        drawLine(True)
    else:
        drawLine(False)
# 上半部分
    t.left(90)
    if d in [0,4,5,6,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    if d in [0,2,3,5,6,7,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    if d in [0,1,2,3,4,7,8,9]:
        drawLine(True)
    else:
        drawLine(False)
    t.left(180)
    t.penup()
    t.fd(20)

def drawLine(draw):
    drawGap()
    if draw:
        t.pendown()
    else:
        t.penup()
    t.fd(40)
    drawGap()
    t.right(90)

def drawGap():
    t.penup()
    t.fd(5)


# 下半部分
# 第一画：[2,3,4,5,6,8,9]
# 第二画：[0,1,3,4,5,6,7,8,9]
# 第三画：[0,2,3,5,6,8,9]
# 第四画：[0,2,6,8]
# 上半部分
# 第五画：[0,4,5,6,8,9]
# 第六画：[0,2,3,5,6,7,8,9]
# 第一画：[0,1,2,3,4,7,8,9]
def main():

    t.setup(800,350,200,200)
    t.pencolor('red')
    t.speed(5)
    t.penup()
    t.pensize(5)
    t.fd(-300)
    t.pendown()
    drawDate(datetime.now().strftime("%Y-%m=%d+"))
    t.done()


main()

